home *** CD-ROM | disk | FTP | other *** search
- Path: news-m01.ny.us.ibm.net!usenet
- From: oraeder@ibm.net
- Newsgroups: comp.lang.rexx
- Subject: Re: Need date routine
- Date: 3 Jan 1996 09:32:58 GMT
- Distribution: inet
- Message-ID: <4cdiga$grq@news-s01.ny.us.ibm.net>
- References: <4b9e9v$9j5@blackice.winternet.com> <VA.00000019.00050e2b@slip139-92-17-135.emea.ibm.net>
- Reply-To: oraeder@ibm.net
- NNTP-Posting-Host: slip139-92-41-11.emea.ibm.net
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <VA.00000019.00050e2b@slip139-92-17-135.emea.ibm.net>, ProMicro Limited, London <promico@ibm.net> writes:
- >> I need a date routine which will allow me to give it a julian date and
- >> give me back the mm/dd/yy. Other computations would also be useful but I
- >> need the above for a project I'm working on. Please email to
- >> sluce@winternet.com. Thanks!
- >
- >Please post here in sted, there are more people intrested.
- >
- >
- >
- >
- i was offering to sluce a dll which does the thing, however he needs
- the stuff for VM.
- i was extracting these two routines and recoded it in rexx:
-
- ----------------------------------------------------------------------
- dat2jul.cmd
-
- /* ----------------------------------------------------------------- */
- /* ** Julian Day, Montenbruck p. 50 */
- parse arg y m d .
-
- g1 = 15821004 /* greg-jul calendar correction */
- g2 = 15821015
-
- gw = y*10000 + m*100 + d;
- if (gw>g1)&(gw<g2) then return 0
- if m>2 then do; yy=y; mm=m; end
- else do; yy=y-1; mm=m+12; end
- if gw<=g1 then b=-2
- else b=yy%400-yy%100
- jul=(365.25*yy)%1+(30.6001*(mm+1))%1+b+1720996+d+.5;
- return jul
- ---------------------------------------------------------------------------
- jul2dat.cmd
-
-
- /* ----------------------------------------------------------------- */
- /* ** Kalender-Date, Montenbruck p. 51 */
- /* nicht sauber wenn jahr<0 */
- parse arg jul '.' .
- a = jul+1
- b=0
- if a<2299161 then c = a+1524
- else do; b = ((a-1867216.25)/36524.25)%1
- c = 1525+a+b-b%4
- end
- d = ((c-122.1)/365.25)%1
- e = (d*365.25)%1
- f = ((c-e)/30.6001)%1
- mm = f-1-12*((f/14)%1)
- yy = d-4715-(((7+mm)/10)%1)
- dd = c-e-((f*30.6001)%1)-1*(yy<0)
-
- dat = yy'-'right(mm+100,2)'-'right(dd+100,2)
- return dat
- -------------------------------------------------------------------------
- hope that helps
-
- otto raeder
-
-
-
-
-
-
-